package com.hibase.core.mq.factory;

import java.lang.reflect.Method;

/**
 * @author chenfeng
 * @version 1.0
 * @date 2021/7/15 15:15
 * @des https://gitee.com/cheershi
 */
public class HibaseQueueHandler implements IHandler{

    private QueueHandler queueHandler;

    @Override
    public Object run(Method method, Object[] args) throws Exception {
        return queueHandler.execute(method, args);
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if(Object.class.equals(method.getDeclaringClass())){
            return method.invoke(this,args);
        }else{
            return run(method,args);
        }
    }

    public void setQueueHandler(QueueHandler queueHandler){
        this.queueHandler =queueHandler;
    }
}
